import { queryUrlParams } from '@/utils/index'
import request from '@/utils/request'

// 查询所有消息
export function getAllList(data) {
  const param = queryUrlParams(data)
  return request({
    url: `api/message/getAllList?${param}`,
    method: 'get'
  })
}

// 查询所有未读消息
export function getAllNoList(data) {
  const param = queryUrlParams(data)
  return request({
    url: `api/message/getAllNoList?${param}`,
    method: 'get'
  })
}

// 轮询查询消息
export function noticeList(data) {
  const param = queryUrlParams(data)
  return request({
    url: `api/message/noticeList?${param}`,
    method: 'get'
  })
}

// 修改已读
export function removeById(id) {
  const param = queryUrlParams({
    ids: [id]
  })
  return request({
    url: `/api/message/remove?${param}`,
    method: 'post'
  })
}

// 全部标记为已读
export function removeByType() {
  return request({
    url: `/api/message/removeByType?type=1`,
    method: 'post'
  })
}

// 轮询查询消息
export function noReadyCount() {
  return request({
    url: `api/message/count`,
    method: 'get'
  })
}
